<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @keyframes shake {
            0%{
                transform: translateX(-100px);
            }
            50%{
                transform: translateX(-50px);
            }
            100%{
                transform: translateX(50px);
            }
        }
        .v-enter-from{
            color:red;
        }
        .v-enter-active{
            animation:shake 3s;
            transition: color 3s ease-in;
        }
        .v-leave-active{
            color:red;
            animation:shake 3s;
            transition: all 3s ease-in;
        }
    </style>
</head>
<body>
    <div id="root"></div>
</body>
</html>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
        data(){
            return{
                show:false,
            }
        },
        methods:{
            handleClick(){
                this.show=!this.show
            }
        },
        template:`
        <div>
            <transition>
                <div v-if="show">hello world</div>
            </transition>
            <button @click="handleClick">切换</button>
        </div>
        `
    })
    const vm = app.mount('#root')
</script>